<?php
include("../jphpframework.php");

$form = new JForm('Login');

$form->setDefaults(array(
'username'=>'Jim',
'password'=>"test",
'desc'=>'testing 123',
'seltest'=>'jim'));

$form->addelement('text', 'username', 'Username');
$form->addelement('password', 'password', 'Password');
$form->addelement('password', 'password2', 'Password2');
$form->addelement('textarea', 'desc', 'Description');
$form->addelement('checkbox', 'check1', 'Check It', 'good');
$form->addelement('radio', 'rad1', 'Radio 1', 'radsssio');
$form->addelement('select', 'seltest', "Select One", array(''=>'-Select-','jim'=>"Jim", 'bill'=>"Bill"));
$form->addelement('file', 'upload', 'Image');
$form->addelement('button', 'cancel', 'Cancel');
$form->addelement('submit', 'send', "Save");


$form->addrule('username', "Please enter a username", "required");
$form->addrule('username', "Too long", 'maxlength', 5);
$form->addrule('desc', "Text is too long", 'maxlength', 4);

$form->setElementTemplate('<tr><td>TEST</td><td></td></tr>', 'password2');

if($form->validate()){
echo 'here';
}

echo $form->toHtml();